<template>
	<ApldTable :columns="item.column" :data="tableData"></ApldTable>
</template>

<script setup lang="ts">
import { ApldTable } from '@/components/AplidCrud'
type Props = {
	item?: any
	value?: any
}
const props = withDefaults(defineProps<Props>(), {})

const tableData = ref([])

const getInitData = () => {}
watch(
	() => props.value,
	(val) => {
		try {
			tableData.value = JSON.parse(val)
			if (props.item.api) {
				getInitData()
			}
		} catch (error) {
			tableData.value = Array.isArray(val) ? val : []
		}
	},
	{
		immediate: true,
		deep: true,
	}
)
</script>

<style scoped></style>
